// state '状态 1 待审核   5待接单    10待纸样 15待裁   20待车  25待审样  30待工艺  35待报价   40结束',

function  findOneInArrayPlus(array=[],cb){
  for (let i = 0; i <array.length ; i++) {
    var isyes= cb(array[i],i)
    if(isyes){
      return array[i]
    }
  }
}

export const develop_state = {
  noBegin: 1,
  tackOrder: 5,
  page: 10,
  cut: 15,
  car: 20,
  check: 25,
  process: 30,
  turnover: 35,
  price: 40,
  end: 45,
};

export const develop_state_eglish = {
  1: 'noBegin',
  5: 'tackOrder',
  10: 'page',
  15: 'cut',
  20: 'car',
  25: 'check',
  26: '第二次审样', // 头版ie报价  第二次审样 大货纸样
  30: 'process',
  35: 'turnover',
  40: 'price',
  45: 'end',
};


export const develop_state_ch = {
  1: '待审核',
  5: '待接单',
  6: '面辅料',
  7: '面辅料等待指派',
  8: '面辅料等待指派',
  10: '待纸样',
  15: '待裁',
  16: '设计发工厂',
  17: '生产收货',
  20: '待车',
  21: '待提交审样',
  22: '样衣检查',
  23: '价格优化',
  24: '核价调价',
  25: '待审样',
  26: '第一次报价', // 头版ie报价  第二次审样 大货纸样
  27: '第二次审样',
  29: '大货纸样',
  30: '待工艺',
  31: '物料审核',
  32: '外发核价',
  35: '待交付',
  37: '生产跟进',
  40: '待报价',
  41: '生产核价',
  42: '生产核价后核价',
  43: '店长审价',
  44: '资料变更',
  45: '技术资料审核',
  46: '结束',
};

export const develop_state_pipleline_ch = {
  1: '待指派',
  5: '待开始',
  10: '执行中',
  15: '己结束',

};
export const develop_state_pipleline_english = {
  1: 'toAssign',
  5: 'toStart',
  10: 'doing',
  15: 'end',
};


export function getStatesChinese(arrayState,dic_developStateList=[]) {
  var str = ' ';
  for (let i = 0; i < arrayState.length; i++) {
    var _dicexit=findOneInArrayPlus(dic_developStateList,i2=>i2?.value==arrayState[i])
    var  __str=_dicexit?.label
    if(!__str){
      __str=develop_state_ch[arrayState[i]]
    }
    if(__str){
      str += `【${__str||''}】,`;
    }

  }
  return str.substr(0, str.length - 1);
}


export function getPiplineStatesChinese(arrayState) {
  var str = ' ';
  for (let i = 0; i < arrayState.length; i++) {
    str += `【${develop_state_pipleline_ch[arrayState[i]]}】,`;
  }
  return str.substr(0, str.length - 1);
}


